package org.codersunit.radboid;

import java.util.Calendar;
import java.util.GregorianCalendar;

import org.codersunit.radboid.data.BasicLecture;
import org.codersunit.radboid.data.Schedule;
import org.codersunit.radboid.view.ScheduleAdapter;

import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;

public class ListScheduleActivity extends ListActivity {
	public final static String PREFERED_ACCOUNT = "pref_account";
	
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        Schedule schedule = new Schedule();
        BasicLecture l1 = new BasicLecture();
        l1.setStart(new GregorianCalendar());
        l1.setDuration(3600 * 2);
        l1.setCode("IBI007");
        l1.setLecturer("Barendsen");
        l1.setLocation("LIN 8");
        l1.setName("Onderzoeksmethoden 1");
        l1.setRemark("bachelorstudenten");
        l1.setType("WC");
        
        BasicLecture l2 = new BasicLecture();
        GregorianCalendar c = new GregorianCalendar();
        c.add(Calendar.HOUR, 2);
        l2.setStart(c);
        l2.setDuration(3600 * 2);
        l2.setCode("I00082");
        l2.setLecturer("Consoli");
        l2.setLocation("HG00.067");
        l2.setName("ICT & Samenleving 1");
        l2.setRemark("");
        l2.setType("HC");
        
        schedule.add(l1);
        schedule.add(l2);
        
        setContentView(R.layout.main);
        
        LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View header = inflater.inflate(R.layout.list_header, getListView(), false);
        getListView().addHeaderView(header, null, false);
        
        setListAdapter(new ScheduleAdapter(this, schedule));
    }
}